<%@page import="org.apache.commons.collections.map.HashedMap"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.cqggrw.util.*"%>
<%@ page import="com.cqggrw.domain.*"%>
<%@ page import="com.cqggrw.service.*"%>
<%@ page import="com.cqggrw.service.impl.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在线杂志</title>
<link href="css/common.css" type="text/css" rel="stylesheet" />
<link href="css/channel.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="jslib/jquery-easyui-1.3.1/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="jslib/jquery-easyui-1.3.1/jquery.easyui.min.js"></script>
<script type="text/javascript" src="jslib/jquery-easyui-1.3.1/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="jslib/tools.js"></script>
<link rel="stylesheet" href="jslib/jquery-easyui-1.3.1/themes/default/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="jslib/jquery-easyui-1.3.1/themes/icon.css" type="text/css"></link>
</head>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";

AdServiceI adService = new AdServiceImpl();
List<Ad> adList = adService.get();
Map<Integer, Ad> adMap = new HashMap<Integer, Ad>();
for(Ad ad : adList) {
	adMap.put(ad.getId(), ad);
}
%>
<body>
	<div class="top">
		<div class="top1">
			<div class="logo">
				<h6>在线杂志</h6>
			</div>
			<div class="times">每日小贴士：2012年4月28日</div>
		</div>
		<div class="menu">
			<a target="_blank" href="<%=basePath%>">公共人物首页</a> - <a target="_blank" href="news.jsp?id=13"><font color="#FF0000">焦点</font>
			</a> - <a target="_blank" href="news.jsp?id=2">关注</a> - <a target="_blank" href="news.jsp?id=4">达人</a> - <a target="_blank" href="news.jsp?id=14">教育</a> - <a target="_blank" href="news.jsp?id=3">精英领导</a> - <a target="_blank" href="news.jsp?id=28">区县</a> - <a target="_blank" href="news.jsp?id=26">观点</a> - <a target="_blank" href="news.jsp?id=2">公共</a> - <a target="_blank" href="news.jsp?id=21">文萃</a> - <a target="_blank" href="news.jsp?id=6">追寻</a> - <a target="_blank" href="news.jsp?id=10">访谈</a> - <a target="_blank" href="news.jsp?id=23">环球</a> - <a target="_blank" href="news.jsp?id=25">体育</a>- <a target="_blank" href="news.jsp?id=29">图说天下</a>
		</div>
	</div>
	<div class="banner">
		<a target="_blank" href="<%=adMap.get(12).getLink()%>"><img src="images/AdImg/<%=adMap.get(12).getImgName()%>" /> </a>
	</div>
	<div class="content4">
		<div class="content3l">
			<div class="recommend">
				<ul class="recom_ul">
					<%
					        
											NewsServiceI<News> service = new NewsServiceImpl();
											List<News> newsList = service.getByTypeId(2);
											int i2 = 1;
											for (News news : newsList) {
												if (i2 > 8)
													break;
					%>
					<li><a target="_blank" href='news/news.jsp?id=<%=news.getId()%>' title='<%=news.getName()%>'><%=news.getName().length() <= 14 ? news.getName() : news
						.getName().substring(0, 14)%></a> <%
 	i2++;
 			 	}
 %>
					
				</ul>
			</div>
			<div class="ad1">
				<a target="_blank" href="<%=adMap.get(22).getLink()%>"><img src="images/AdImg/<%=adMap.get(22).getImgName()%>" /> </a>
			</div>
			<div class="ad1">
				<a target="_blank" href="<%=adMap.get(23).getLink()%>"><img src="images/AdImg/<%=adMap.get(23).getImgName()%>" /> </a>
			</div>
		</div>
		<div class="content4r">
			<%
				int pageInt = 1;
				int pageSize = 6;
				int pageTotal = 0;
				
				String pageIntStr = request.getParameter("page");
				if(pageIntStr != null) {
					pageInt = Integer.parseInt(pageIntStr);
				}
			  
			  	BookServiceI bookService = new BookServiceImpl();
				Book book = new Book();
				book.setPage(pageInt);
				book.setRows(pageSize);
				book.setRows(pageSize);
				Map<String, Object> mapBook = (HashMap<String, Object>)bookService.get(book);
				List<Book> bookList = (ArrayList<Book>)mapBook.get("rows");
				pageTotal = (Integer)mapBook.get("total");
				for(int i = 0; i < 6 && i < bookList.size(); i++) {
					if(i==0 || i == 3) {
				out.println("<ul class=\"magazine\">");
					}
			%>
			<li><a href="Magazine.jsp?bookImg=<%=bookList.get(i).getFmImgFileName()%>"><img width="217" height="289" src="images/bookImg/<%=bookList.get(i).getFmImgFileName()%>.jpg" border="0" /> </a> <strong><a href="Magazine.jsp?bookImg=<%=bookList.get(i).getFmImgFileName()%>"><%=bookList.get(i).getName()%></a> </strong>
				<p>
					<a href="Magazine.jsp?bookImg=<%=bookList.get(i).getFmImgFileName()%>"><img src="images/tup_03.gif" border="0" /> </a> <a href="bookAction!downFile.action?fmImgFileName=<%=bookList.get(i).getFmImgFileName()%>"><img src="images/tup1_03.gif" border="0" /> </a>
				</p>
			</li>
			<%
				if(i==2||i==5) {
					out.println(" </ul>");
				}
				if(!(i < 5 && i < bookList.size()-1)) {
					out.println(" </ul>");
				}
				}
			%>
			<table width="100%">
				<tr>
					<td>
						<div id="pp" style="background:#efefef;border:1px solid #ccc;"></div></td>
				</tr>
			</table>
			<script type="text/javascript">
	$('#pp').pagination({   
	    total:<%=pageTotal%>,   
	    pageSize:<%=pageSize%>,
	    pageNumber:<%=pageInt%>,
	    showRefresh:false,
	    showPageList : false,
	    pageList: [<%=pageSize%>],
	    onSelectPage:function(pageNumber, pageSize){
	    	window.location.href='MagazinePage.jsp?id=<%=pageInt%>&page=' + pageNumber;
					}
				});
			</script>
		</div>
	</div>
	<div class="clear"></div>
	<div class="foot">
		<div class="links">
			<span>友情链接：</span>
			<%
				LinkServiceI linkService = new LinkServiceImpl();
				List<Link> links = (ArrayList<Link>) linkService.get();
				for (int i = 0; i < links.size(); i++) {
			%>
			<a target="_blank" href='<%=links.get(i).getUrl()%>'><%=links.get(i).getName()%></a>
			<%
				if (i < links.size() - 1)
						out.print("|");
				}
			%>
		</div>
		<div class="copyright">
			<div class="company">主办单位：重庆行政公共人物杂志社</div>
			<div class="map">
				<a href="about.jsp?id=1">关于我们</a> | <a href="about.jsp?id=2">杂志简介</a> | <a href="about.jsp?id=3">广告刊例</a> | <a href="about.jsp?id=4">组织机构</a> | <a href="about.jsp?id=5">联系我们</a> | <a href="about.jsp?id=6">本网声明</a> | <a href="about.jsp?id=7">版权声明</a>
			</div>
			<p>
				Copyright &copy; 2008-2012 www.cqggrw.com All Rights Reserved 渝ICP备12001034号-1&nbsp;技术支持：<a href="http://www.cqgew.com">重庆政企</a>
		</div>
	</div>
</body>
</html>
